package com.tajiang.business.common.widget.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

import com.github.rahatarmanahmed.cpv.CircularProgressView;
import com.tajiang.business.R;
import com.tajiang.business.common.application.TJApp;
import com.tajiang.business.common.utils.LogUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2016/9/17.
 */
public class SingletonLoadingDialog extends Dialog {

    private static SingletonLoadingDialog loadingDialog = null;

    @BindView(R.id.progress_view)
    CircularProgressView progressView;

    private SingletonLoadingDialog(Context context) {
        super(context, R.style.default_dialog);
        View view = LayoutInflater.from(context).inflate(R.layout.progress_view, null);
        setContentView(view);
        ButterKnife.bind(this);
        progressView.startAnimation();
    }

    public static SingletonLoadingDialog getSingleDialog() {
        if (loadingDialog == null) {
            LogUtils.e("....  create new Single Dialog");
            loadingDialog = new SingletonLoadingDialog(TJApp.getInstance().getBaseContext());
        } else {
            LogUtils.e("....  get Single Dialog");
        }

        return loadingDialog;
    }

}
